<?php

namespace app\api\controller;
use app\common\model\TeacherCollect as TeacherCollectModel;
use app\common\model\Teacher as TeacherModel;
use app\common\controller\Api;
class Collect extends Api
{
    protected $noNeedLogin = [];
    protected $noNeedRight = ['*'];

    /*
     * 收藏列表
     */
    public function lists()
    {
        $params = $this->request->param();
        $user_id = $this->auth->id;
        $teacher_ids = TeacherCollectModel::where([
            'user_id' => $user_id
        ])->column('teacher_id');
        $data = TeacherModel::getLists([
            'page' => $params['page'],
            'where' => [
                'user_id' => ['in', $teacher_ids]
            ]
        ]);

        $this->success('查询成功',$data);
    }
}